#include <stdio.h>

class base {
public:
	base() : data(0) {
		printf("base()\n");
	}
	base(int _data) : data(_data) {
		printf("base(data)\n");
	}
	virtual void print() {
		printf("%d\n", data);
	}
	int data;
};

class left : public virtual base {
public:
	left(int _data) : base(_data) {
		printf("left\n");
	}
	virtual void print() {
		printf("%d\n", data + 1);
	}
};

class right : public virtual base {
public:
	right(int _data) : base(_data) {
		printf("right\n");
	}
	virtual void print() {
		printf("%d\n", data + 10);
	}
};

class down : public virtual left, public virtual right {
public:
	down(int x) : left(x), right(x) {
		printf("down\n");
	}
	virtual void print() {
		printf("%d\n", data + 100);
	}
};

int main() {
	down A(1);
	{
		class base *p = &A;
		p->print();
	}
	{
		class left *p = &A;
		p->print();
	}
	{
		class right *p = &A;
		p->print();
	}
	{
		class down *p = &A;
		p->print();
	}
	return 0;
}
